/*
Design Pattern Automation Toolkit.
Application to create applications with emphasis on Design patterns.
And support for round trip engineering.
Copyright (C) 2004 Vineeth Neelakant. nvineeth@gmail.com

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
using System;
using System.Collections;
using dpatoolkit.UILayer;
using System.Windows.Forms;
using BusinessLayer;
using System.Drawing;


namespace BusinessLayer
{
    /// <summary>
    /// Static container for the projects open, the state of the application (depending on hte user action) , etc.,.
    /// </summary>
    class DPAppData
    {
        private static ActionTaken request = ActionTaken.None;

        /// <summary>
        /// Project Manager : Singleton
        /// </summary>
        private static IUIProjectManager projManager;

        /// <summary>
        /// Multiple Doc Intf Manager : Singleton
        /// </summary>
        private static IMDIManager mdiManager;

        /// <summary>
        /// Initialization of Application wide data should go here;
        /// Ex : Singletons, Reading of config file, loading of common DLLs.,
        /// </summary>
        static DPAppData()
        {
            projManager = new DPAProjectManager();
            mdiManager = new DockPanelMdiManager();
        }

        public static IUIProjectManager ProjectManager
        {
            get
            {
                return projManager;
            }
        }

        public static IMDIManager MDIManager
        {
            get
            {
                return mdiManager;
            }
        }

#region UI RELATED

        public static ActionTaken RequestedAction
        {
            get
            {
                return request;
            }
            set
            {
                request = (ActionTaken)value ;
                if (request == ActionTaken.None)
                {
                    ResetState();
                }
                else
                {
                    switch (value)
                    {
                        case ActionTaken.CreateClass:
                            mdiManager.ShowStatusMessage("Click on the canvas to add the class.");
                            break;
                        case ActionTaken.AddInheritance:
                            mdiManager.ShowStatusMessage("Drag a Line between Base Class and Derived Class");
                            break;
                        case ActionTaken.AddSingleReference:
                            mdiManager.ShowStatusMessage("Drag a Line between Referenced Class and Referer");
                            break;
                        case ActionTaken.AddMultiReference:
                            mdiManager.ShowStatusMessage("Drag a Line between Referenced Class and Referer");
                            break;
                        case ActionTaken.AddMultiAggretation:
                            mdiManager.ShowStatusMessage("Drag a Line between Aggregatee and Aggregator.");
                            break;
                        case ActionTaken.AddSingleAggretation:
                            mdiManager.ShowStatusMessage("Drag a Line between Aggregatee and Aggregator.");
                            break;
                        case ActionTaken.AddMultiCreates:
                            mdiManager.ShowStatusMessage("Drag a Line between created class and the creator class");
                            break;
                        case ActionTaken.AddSingleCreates:
                            mdiManager.ShowStatusMessage("Drag a Line between created class and the creator class");
                            break;
                        default:
                            mdiManager.ShowStatusMessage("Ready");
                            break;

                    }
                }
            }

        }

        public static void ResetState()
        {
            request = ActionTaken.None;
            mdiManager.ResetStatusMessage();
        }

#endregion

    }
}

